package com.home.rest;

import com.github.pagehelper.PageInfo;
import com.home.base.msg.ObjectRestResponse;
import com.home.base.msg.TableResultResponse;
import com.home.base.rest.BaseRestController;
import com.home.biz.JobUserBiz;
import com.home.biz.PhoneBiz;
import com.home.entity.CoinResult;
import com.home.entity.FetchPhone;
import com.home.entity.JobUser;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ：chenxf
 * @date ：Created in 2020/3/18 13:37
 * @description：
 * @modified By：
 * @version: $
 */
@RestController
@RequestMapping("phone")
public class PhoneController extends BaseRestController<PhoneBiz, FetchPhone> {


    @PostMapping("/fetch")
    public ObjectRestResponse fetch(@RequestParam(defaultValue = "000000") String sNum,@RequestParam(defaultValue = "000005")String eNum,@RequestParam String token,@RequestParam String veryCode,@RequestParam String price,@RequestParam String num) {
        //  this.getCurrentId();//检验权限
        baseBiz.fetch(sNum,eNum,token,veryCode,price,num);
        return ObjectRestResponse.success("设置成功");
    }

    @GetMapping("/list")
    public TableResultResponse<CoinResult> list(int limit, int offset,String phoneNum,String cityName) {
        //  this.getCurrentId();//检验权限
        List<CoinResult> items = baseBiz.list(limit,offset,false);

        return new TableResultResponse<>(items.size(),
                limit, offset,
                items);
    }

    @GetMapping("/success")
    public TableResultResponse<CoinResult> success(int limit, int offset,String phoneNum,String cityName) {
        //  this.getCurrentId();//检验权限
        List<CoinResult> items = baseBiz.list(limit,offset,true);

        return new TableResultResponse<>(items.size(),
                limit, offset,
                items);
    }

}
